package com.venn.controller;

import com.venn.entity.ResultMessage;
import com.venn.util.AddPartition;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Venn on 2017/8/14.
 */
@Controller
@RequestMapping("/tools")
public class ToolsController {

    @RequestMapping("/addpartitions")
    public String addPartitions(){

        return "/tools/addpartitions";
    }
    @RequestMapping("/createPartition")
    @ResponseBody
    public ResultMessage createPartition(String tableName, String partitionName,String initial, String next, String startTime, String endTime){

//        startTime = startTime.replace("/","");
//        endTime = endTime.replace("/","");
        String partition = AddPartition.addPartition(tableName,partitionName,initial,next,startTime,endTime);
        ResultMessage rm = new ResultMessage();
        rm.setCode("0");
        rm.setMsg(partition);
        return rm;
    }
}
